const enterFullScreen = () => {
  const element = document.documentElement
  const requestMethod = element['requestFullScreen'] || //W3C
    element.webkitRequestFullScreen || //FireFox
    element['mozRequestFullScreen'] || //Chrome等
    element['msRequestFullScreen'] //IE11
  if (requestMethod) {
    requestMethod.call(element);
  } else if (typeof window.ActiveXObject !== "undefined") { //for Internet Explorer
    const wScript = new ActiveXObject("WScript.Shell")
    if (wScript !== null) {
      wScript.SendKeys("{F11}")
    }
  }
}


const exitFullScreen = () => {
  // 判断各种浏览器，找到正确的方法
  const exitMethod = document.exitFullscreen || //W3C
    document['mozCancelFullScreen'] || //FireFox
    document.webkitExitFullscreen || //Chrome等
    document.webkitExitFullscreen; //IE11
  if (exitMethod) {
    exitMethod.call(document);
  } else if (typeof window.ActiveXObject !== "undefined") { //for Internet Explorer
    const wScript = new ActiveXObject("WScript.Shell");
    if (wScript !== null) {
      wScript.SendKeys("{F11}");
    }
  }
}

export {enterFullScreen, exitFullScreen}